## $Id: Makefile.am,v 1.14 2005/07/27 12:10:01 joostvb Exp $

## We need an automake > 1.4 to be able to have files deep down in
## directorytrees in foo_DATA.
## We don't want to clutter the examples with our own build stuff;
## we need to do everything here.

exdir = $(datadir)/doc/$(PACKAGE)/examples

extopdir = $(exdir)
extopsrc = \
  cc-g.m4 ltdl-loader.c ltdl-module.c openmode.m4 reexec.sh rpl_fopen.c \
  simple-loader.c simple-module.c
extop_DATA = $(extopsrc)
extoptex = \
  configure_1.texi cc-g.texi ltdl-loader.texi ltdl-module.texi openmode.texi \
  reexec.texi rpl_fopen.texi simple-loader.texi simple-module.texi

exconveniencetopdir = $(exdir)/convenience
exconveniencetopsrc = \
  convenience/Makefile.am convenience/bootstrap convenience/configure.in \
  convenience/error.c convenience/error.h convenience/main.c
exconveniencetop_DATA = $(exconveniencetopsrc)
exconveniencelibdir = $(exconveniencetopdir)/lib
exconveniencelibsrc = \
  convenience/lib/Makefile.am convenience/lib/source.c convenience/lib/source.h
exconveniencelib_DATA = $(exconveniencelibsrc)
exconveniencereplacedir = $(exconveniencetopdir)/replace
exconveniencereplacesrc = \
  convenience/replace/Makefile.am convenience/replace/basename.c
exconveniencereplace_DATA = $(exconveniencereplacesrc)
exconveniencesrc = \
  $(exconveniencetopsrc) $(exconveniencelibsrc) $(exconveniencereplacesrc)
exconveniencetex = \
  convenience/Makefile.texi convenience/configure.texi \
  convenience/error.texi convenience/error_h.texi \
  convenience/main.texi convenience/lib/Makefile.texi \
  convenience/lib/source.texi convenience/lib/source_h.texi \
  convenience/replace/Makefile.texi convenience/replace/basename.texi

excygwindir = $(exdir)/cygwin-hello
excygwinsrc = \
  cygwin-hello/Makefile.am cygwin-hello/bootstrap cygwin-hello/configure.in \
  cygwin-hello/hello.c cygwin-hello/hello.h cygwin-hello/main.c
excygwin_DATA = $(excygwinsrc)

exfoonlydir = $(exdir)/foonly
exfoonlysrc = \
  foonly/configure.in foonly/foo.c foonly/main.c foonly/Makefile.am \
  foonly/nly.c foonly/parser.y foonly/scanner.l
exfoonly_DATA = $(exfoonlysrc)
exfoonlytex = foonly/Makefile.texi foonly/configure.texi

exhellodir = $(exdir)/hello
exhellosrc = \
  hello/Makefile.am hello/bootstrap hello/configure.in hello/hello.c \
  hello/main.c
exhello_DATA = $(exhellosrc)
exhellotex = hello/hello.texi hello/main.texi

exintrodir = $(exdir)/intro-hello
exintrosrc = \
  intro-hello/hello.c intro-hello/main.c intro-hello/trim.c
exintro_DATA = $(exintrosrc)
exintrotex = \
  intro-hello/hello.texi intro-hello/main.texi intro-hello/trim.texi

exshelldir = $(exdir)/shell
exshellsrc = shell/reexec.sh
exshell_DATA = $(exshellsrc)

exsiccomplextopdir = $(exdir)/sic-complex
exsiccomplextopsrc = \
  sic-complex/AUTHORS sic-complex/COPYING sic-complex/ChangeLog \
  sic-complex/INSTALL sic-complex/Makefile.am sic-complex/NEWS \
  sic-complex/README sic-complex/THANKS sic-complex/TODO \
  sic-complex/_sicrc sic-complex/bootstrap sic-complex/configure.in \
  sic-complex/mkstamp
exsiccomplextop_DATA = $(exsiccomplextopsrc)
exsiccomplexconfigdir = $(exsiccomplextopdir)/config
exsiccomplexconfigsrc = \
  sic-complex/config/readline.m4 \
  sic-complex/config/sys_errlist.m4 \
  sic-complex/config/sys_siglist.m4
exsiccomplexconfig_DATA = $(exsiccomplexconfigsrc)
exsiccomplexdocdir = $(exsiccomplextopdir)/doc
exsiccomplexdocsrc = \
  sic-complex/doc/Makefile.am \
  sic-complex/doc/sic.texi
exsiccomplexdocdata = $(exsiccomplexdocsrc)
exsiccomplexmodulesdir = $(exsiccomplextopdir)/modules
exsiccomplexmodulessrc = \
  sic-complex/modules/Makefile.am \
  sic-complex/modules/cd.c \
  sic-complex/modules/dollar.c \
  sic-complex/modules/eval.c \
  sic-complex/modules/sqrt.c \
  sic-complex/modules/unknown.c
exsiccomplexmodules_DATA = $(exsiccomplexmodulessrc)
exsiccomplexreplacedir = $(exsiccomplextopdir)/replace
exsiccomplexreplacesrc = \
  sic-complex/replace/Makefile.am \
  sic-complex/replace/basename.c \
  sic-complex/replace/readline.c \
  sic-complex/replace/strcspn.c \
  sic-complex/replace/strerror.c \
  sic-complex/replace/strsignal.c \
  sic-complex/replace/strspn.c \
  sic-complex/replace/vfprintf.c \
  sic-complex/replace/waitpid.c
exsiccomplexreplace_DATA = $(exsiccomplexreplacesrc)
exsiccomplexsicdir =  $(exsiccomplextopdir)/sic
exsiccomplexsicsrc = \
  sic-complex/sic/Makefile.am sic-complex/sic/builtin.c \
  sic-complex/sic/builtin.h sic-complex/sic/common-h.in \
  sic-complex/sic/error.c sic-complex/sic/error.h \
  sic-complex/sic/eval.c sic-complex/sic/eval.h \
  sic-complex/sic/list.c sic-complex/sic/list.h \
  sic-complex/sic/ltdl.c sic-complex/sic/ltdl.h \
  sic-complex/sic/module.c sic-complex/sic/module.h \
  sic-complex/sic/sic.c sic-complex/sic/sic.h \
  sic-complex/sic/syntax.c sic-complex/sic/syntax.h \
  sic-complex/sic/xmalloc.c sic-complex/sic/xstrdup.c \
  sic-complex/sic/xstrerror.c
exsiccomplexsic_DATA = $(exsiccomplexsicsrc)
exsiccomplexsrcdir = $(exsiccomplextopdir)/src
exsiccomplexsrcsrc = \
  sic-complex/src/Makefile.am \
  sic-complex/src/sic.c \
  sic-complex/src/sic_builtin.c \
  sic-complex/src/sic_repl.c \
  sic-complex/src/sic_repl.h \
  sic-complex/src/sic_syntax.c
exsiccomplexsrc_DATA = $(exsiccomplexsrcsrc)
exsiccomplextestsdir = $(exsiccomplextopdir)/tests
exsiccomplextestssrc = \
  sic-complex/tests/Makefile.am sic-complex/tests/Makefile.in \
  sic-complex/tests/boilerplate.test sic-complex/tests/builtin-unload.test \
  sic-complex/tests/cmd-subst-2.test sic-complex/tests/cmd-subst.test \
  sic-complex/tests/defs sic-complex/tests/empty-eval-2.test \
  sic-complex/tests/empty-eval-3.test sic-complex/tests/empty-eval.test \
  sic-complex/tests/incomplete.test sic-complex/tests/multicmd-subst.test \
  sic-complex/tests/multicmd.test sic-complex/tests/syntax-unload-2.test \
  sic-complex/tests/syntax-unload.test sic-complex/tests/var-subst-2.test \
  sic-complex/tests/var-subst.test
exsiccomplextests_DATA = $(exsiccomplextestssrc)
exsiccomplexsrc = \
  $(exsiccomplextopsrc) \
  $(exsiccomplexconfigsrc) \
  $(exsiccomplexdocsrc) \
  $(exsiccomplexmodulessrc) \
  $(exsiccomplexreplacesrc) \
  $(exsiccomplextestssrc) \
  $(exsiccomplexsicsrc) \
  $(exsiccomplexsrcsrc)
exsiccomplextex = \
  sic-complex/modules/Makefile_1.texi \
  sic-complex/modules/Makefile_2.texi \
  sic-complex/modules/unknown_1.texi \
  sic-complex/sic/Makefile_1.texi \
  sic-complex/sic/common-h.texi \
  sic-complex/sic/module_1.texi sic-complex/sic/module_2.texi \
  sic-complex/sic/module_3.texi sic-complex/sic/module_4.texi \
  sic-complex/sic/module_5.texi \
  sic-complex/sic/module_h_1.texi \
  sic-complex/src/sic_builtin_1.texi \
  sic-complex/src/sic_builtin_2.texi \
  sic-complex/src/sic_1.texi sic-complex/src/sic_2.texi \
  sic-complex/src/sic_repl_1.texi

exsiclargetopdir = $(exdir)/sic-large
exsiclargetopsrc = \
  sic-large/AUTHORS \
  sic-large/COPYING \
  sic-large/ChangeLog \
  sic-large/INSTALL \
  sic-large/Makefile.am \
  sic-large/NEWS \
  sic-large/README \
  sic-large/THANKS \
  sic-large/TODO \
  sic-large/bootstrap \
  sic-large/configure.in
exsiclargetop_DATA = $(exsiclargetopsrc)
exsiclargeconfigdir = $(exsiclargetopdir)/config
exsiclargeconfigsrc = \
  sic-large/config/readline.m4 \
  sic-large/config/sys_errlist.m4 \
  sic-large/config/sys_siglist.m4
exsiclargeconfig_DATA = $(exsiclargeconfigsrc)
exsiclargedocdir = $(exsiclargetopdir)/doc
exsiclargedocsrc = \
  sic-large/doc/Makefile.am \
  sic-large/doc/sic.texi
exsiclargedoc_DATA = $(exsiclargedocsrc)
exsiclargereplacedir = $(exsiclargetopdir)/replace
exsiclargereplacesrc = \
  sic-large/replace/Makefile.am \
  sic-large/replace/basename.c \
  sic-large/replace/readline.c \
  sic-large/replace/strcspn.c \
  sic-large/replace/strerror.c \
  sic-large/replace/strsignal.c \
  sic-large/replace/strspn.c \
  sic-large/replace/vfprintf.c \
  sic-large/replace/waitpid.c
exsiclargereplace_DATA = $(exsiclargereplacesrc)
exsiclargesicdir = $(exsiclargetopdir)/sic
exsiclargesicsrc = \
  sic-large/sic/Makefile.am sic-large/sic/builtin.c sic-large/sic/builtin.h \
  sic-large/sic/common-h.in sic-large/sic/error.c sic-large/sic/error.h \
  sic-large/sic/eval.c sic-large/sic/eval.h sic-large/sic/list.c \
  sic-large/sic/list.h sic-large/sic/sic.c sic-large/sic/sic.h \
  sic-large/sic/syntax.c sic-large/sic/syntax.h sic-large/sic/xmalloc.c \
  sic-large/sic/xstrdup.c sic-large/sic/xstrerror.c
exsiclargesic_DATA = $(exsiclargesicsrc)
exsiclargesrcdir = $(exsiclargetopdir)/src
exsiclargesrcsrc = \
  sic-large/src/Makefile.am \
  sic-large/src/sic.c \
  sic-large/src/sic_builtin.c \
  sic-large/src/sic_builtin.h \
  sic-large/src/sic_repl.c \
  sic-large/src/sic_repl.h \
  sic-large/src/sic_syntax.c \
  sic-large/src/sic_syntax.h
exsiclargesrc_DATA = $(exsiclargesrcsrc)
exsiclargetestdir = $(exsiclargetopdir)/tests
exsiclargetestssrc = \
  sic-large/tests/Makefile.am \
  sic-large/tests/boilerplate.test \
  sic-large/tests/defs \
  sic-large/tests/empty-eval-2.test \
  sic-large/tests/empty-eval-3.test \
  sic-large/tests/empty-eval.test \
  sic-large/tests/incomplete.test \
  sic-large/tests/multicmd.test
exsiclargetest_DATA = $(exsiclargetestsrc)
exsiclargesrc = \
  $(exsiclargetopsrc) \
  $(exsiclargeconfigsrc) \
  $(exsiclargedocsrc) \
  $(exsiclargereplacesrc) \
  $(exsiclargesicsrc) \
  $(exsiclargesrcsrc) \
  $(exsiclargetestssrc)
exsiclargetex = \
  sic-large/Makefile_1.texi sic-large/Makefile_2.texi \
  sic-large/bootstrap.texi sic-large/configure_1.texi \
  sic-large/configure_2.texi sic-large/configure_3.texi \
  sic-large/configure_4.texi sic-large/configure_5.texi \
  sic-large/doc/Makefile_1.texi sic-large/doc/Makefile_2.texi \
  sic-large/doc/sic_1.texi sic-large/replace/Makefile_1.texi \
  sic-large/sic/Makefile_1.texi sic-large/sic/Makefile_2.texi \
  sic-large/sic/error_h_1.texi sic-large/sic/error_1.texi \
  sic-large/tests/Makefile_1.texi sic-large/tests/defs.texi \
  sic-large/tests/incomplete_1.texi

exsicsmalltopdir = $(exdir)/sic-small
exsicsmalltopsrc = \
  sic-small/Makefile.am \
  sic-small/bootstrap \
  sic-small/configure.in
exsicsmalltop_DATA = $(exsicsmalltopsrc)
exsicsmallconfigdir = $(exsicsmalltopdir)/config
exsicsmallconfigsrc = \
  sic-small/config/readline.m4 \
  sic-small/config/sys_errlist.m4 \
  sic-small/config/sys_siglist.m4
exsicsmallconfig_DATA = $(exsicsmallconfigsrc)
exsicsmallreplacedir = $(exsicsmalltopdir)/replace
exsicsmallreplacesrc = \
  sic-small/replace/Makefile.am \
  sic-small/replace/basename.c \
  sic-small/replace/readline.c \
  sic-small/replace/strcspn.c \
  sic-small/replace/strerror.c \
  sic-small/replace/strsignal.c \
  sic-small/replace/strspn.c \
  sic-small/replace/waitpid.c
exsicsmallreplace_DATA = $(exsicsmallreplacesrc)
exsicsmallsicdir = $(exsicsmalltopdir)/sic
exsicsmallsicsrc = \
  sic-small/sic/Makefile.am sic-small/sic/builtin.c sic-small/sic/builtin.h \
  sic-small/sic/common.h sic-small/sic/error.c sic-small/sic/error.h \
  sic-small/sic/eval.c sic-small/sic/eval.h sic-small/sic/list.c \
  sic-small/sic/list.h sic-small/sic/sic.c sic-small/sic/sic.h \
  sic-small/sic/syntax.c sic-small/sic/syntax.h sic-small/sic/xmalloc.c \
  sic-small/sic/xstrdup.c sic-small/sic/xstrerror.c
exsicsmallsic_DATA = $(exsicsmallsicsrc)
exsicsmallsrcdir = $(exsicsmalltopdir)/src
exsicsmallsrcsrc = \
  sic-small/src/Makefile.am \
  sic-small/src/sic.c \
  sic-small/src/sic.h \
  sic-small/src/sic_builtin.c \
  sic-small/src/sic_repl.c \
  sic-small/src/sic_syntax.c
exsicsmallsrc_DATA = $(exsicsmallsrcsrc)
exsicsmallsrc = \
  $(exsicsmalltopsrc) \
  $(exsicsmallconfigsrc) \
  $(exsicsmallreplacesrc) \
  $(exsicsmallsicsrc) \
  $(exsicsmallsrcsrc)
exsicsmalltex = \
  sic-small/bootstrap.texi sic-small/config/readline.texi \
  sic-small/config/sys_errlist.texi sic-small/replace/Makefile.texi \
  sic-small/replace/strcspn_1.texi sic-small/sic/common_h_1.texi \
  sic-small/sic/common_h_2.texi sic-small/sic/common_h_3.texi \
  sic-small/sic/common_h_4.texi sic-small/sic/builtin_h_1.texi \
  sic-small/sic/error_h_1.texi sic-small/sic/eval_h_1.texi \
  sic-small/sic/error_1.texi sic-small/sic/error_2.texi \
  sic-small/sic/list_h_1.texi sic-small/sic/list_1.texi \
  sic-small/sic/sic_h_1.texi sic-small/sic/syntax_h_1.texi \
  sic-small/sic/xmalloc_1.texi sic-small/src/sic_builtin_1.texi \
  sic-small/src/sic_repl_1.texi sic-small/src/sic_1.texi \
  sic-small/src/sic_h_1.texi sic-small/src/sic_syntax_1.texi


EXTRA_DIST	= \
  $(extopsrc) $(exconveniencesrc) $(excygwinsrc) $(exfoonlysrc) \
  $(exhellosrc) $(exintrosrc) $(exshellsrc) $(exsiccomplexsrc) \
  $(exsiclargesrc) $(exsicsmallsrc) $(noinst_DATA) configure.in

noinst_DATA = \
  $(extoptex) $(exconveniencetex) $(exfoonlytex) $(exhellotex) $(exintrotex) \
  $(exsiccomplextex) $(exsiclargetex) $(exsicsmalltex)

CLEANFILES	= $(noinst_DATA)
MAINTAINERCLEANFILES = Makefile.in simple-loader simple-module.o \
		simple-module.so

SUFFIXES	= .am .in .m4 .test .texi .c .h _h.texi .l _l.texi \
		  _1.texi _2.texi _3.texi _4.texi _5.texi _6.texi \
		  _h_1.texi _h_2.texi _h_3.texi _h_4.texi

sedexp		= "s/[{}@]/@&/g;s/	/        /g"

.m4.texi:
	$(mkinstalldirs) $(top_builddir)/examples/sic-small/config
	sed "/^# @start 1/,/# @end 1/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.texi_1.texi:
	sed "/^@c @start 1/,/@c @end 1/p;d" $< | grep -v '@c @' | sed $(sedexp) >$@

.test_1.texi:
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

.c.texi:
	$(mkinstalldirs) $(top_builddir)/examples/hello
	$(mkinstalldirs) $(top_builddir)/examples/intro-hello
	sed $(sedexp) $< > $@

.l_l.texi:
	sed $(sedexp) $< > $@

.c_1.texi:
	$(mkinstalldirs) $(top_builddir)/examples/sic-small/src
	$(mkinstalldirs) $(top_builddir)/examples/sic-complex/src
	sed "/^\/\*\* @start 1 /,/\/\*\* @end 1 /p;d" $< | grep -v '/** @' | sed $(sedexp) >$@

.c_2.texi:
	sed '/^\/\*\* @start 2 /,/\/\*\* @end 2 /p;d' $< | grep -v '/** @'| sed $(sedexp) >$@

.c_3.texi:
	sed '/^\/\*\* @start 3 /,/\/\*\* @end 3 /p;d' $< | grep -v '/** @' | sed $(sedexp) >$@

.c_4.texi:
	sed '/^\/\*\* @start 4 /,/\/\*\* @end 4 /p;d' $< | grep -v '/** @' | sed $(sedexp) >$@

.c_5.texi:
	sed '/^\/\*\* @start 5 /,/\/\*\* @end 5 /p;d' $< | grep -v '/** @' | sed $(sedexp) >$@

.c_6.texi:
	sed '/^\/\*\* @start 6 /,/\/\*\* @end 6 /p;d' $< | grep -v '/** @' | sed $(sedexp) >$@

.h_h.texi:
	sed $(sedexp) $< > $@

.h_h_1.texi:
	$(mkinstalldirs) $(top_builddir)/examples/sic-small/sic
	sed "/^\/\*\* @start 1 /,/\/\*\* @end 1 /p;d" $< | grep -v '/** @' | sed $(sedexp) >$@

.h_h_2.texi:
	sed '/^\/\*\* @start 2 /,/\/\*\* @end 2 /p;d' $< | grep -v '/** @'| sed $(sedexp) >$@

.h_h_3.texi:
	sed '/^\/\*\* @start 3 /,/\/\*\* @end 3 /p;d' $< | grep -v '/** @'| sed $(sedexp) >$@

.h_h_4.texi:
	sed '/^\/\*\* @start 4 /,/\/\*\* @end 4 /p;d' $< | grep -v '/** @'| sed $(sedexp) >$@

.in.texi:
	sed $(sedexp) $< > $@

.in_1.texi:
	sed "/^# @start 1/,/# @end 1/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.in_2.texi:
	sed "/^# @start 2/,/# @end 2/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.in_3.texi:
	sed "/^# @start 3/,/# @end 3/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.in_4.texi:
	sed "/^# @start 4/,/# @end 4/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.in_5.texi:
	sed "/^# @start 5/,/# @end 5/p;d" $< | grep -v '# @' | sed $(sedexp) >$@

.am.texi:
	$(mkinstalldirs) $(top_builddir)/examples/convenience
	$(mkinstalldirs) $(top_builddir)/examples/convenience/lib
	$(mkinstalldirs) $(top_builddir)/examples/convenience/replace
	$(mkinstalldirs) $(top_builddir)/examples/sic-small/replace
	$(mkinstalldirs) $(top_builddir)/examples/sic-large/replace
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

.am_1.texi:
	$(mkinstalldirs) $(top_builddir)/examples/sic-large
	$(mkinstalldirs) $(top_builddir)/examples/sic-large/doc
	$(mkinstalldirs) $(top_builddir)/examples/sic-large/sic
	$(mkinstalldirs) $(top_builddir)/examples/sic-large/tests
	$(mkinstalldirs) $(top_builddir)/examples/sic-complex/modules
	$(mkinstalldirs) $(top_builddir)/examples/sic-complex/sic
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

.am_2.texi:
	sed "/^## @start 2/,/## @end 2/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

.am_3.texi:
	sed "/^## @start 3/,/## @end 3/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

sic-small/bootstrap.texi: sic-small/bootstrap
	$(mkinstalldirs) $(top_builddir)/examples/sic-small
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

sic-large/bootstrap.texi: sic-large/bootstrap
	$(mkinstalldirs) $(top_builddir)/examples/sic-large
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

sic-large/tests/defs.texi: sic-large/tests/defs
	$(mkinstalldirs) $(top_builddir)/examples/sic-large/tests
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

sic-complex/sic/common-h.texi: sic-complex/sic/common-h.in
	$(mkinstalldirs) $(top_builddir)/examples/sic-complex/sic
	sed "/^## @start 1/,/## @end 1/p;d" $< | grep -v '## @' | sed $(sedexp) >$@

reexec.texi: reexec.sh
	sed $(sedexp) $< > $@

